// 登陆授权
import { POST } from '@/api/http';

// import oauth2 from '@/assets/data/com.xgggh.srv.oauth2/oauth.json';
// export function authorize(body) {
  // fetch
  // POST(url, JSON.stringify(params), callback);
  // axios
// }
const service = 'com.xgggh.srv.oauth2';
const url = 'auth';

export function authorize(body) {
  const params = {
    method: 'Oauth2.Token',
    service,
    request: `${JSON.stringify(body)}`,
  };
  return POST(url, params);
}

// 退出登陆
export function logout(body) {
  const params = {
    method: 'Oauth2.Logout',
    service,
    request: `${JSON.stringify(body)}`,
  };
  return POST(url, params);
}

export default { authorize, logout };
